#include "utility.h"
#include <iostream>
#include "gtest/gtest.h"
#include "gmock/gmock.h"

using namespace std;

class MockUtility : public base
{
public:
    MOCK_METHOD(int, ArithmeticCalculation, (CalcType, int, int));
};

using ::testing::_;
using ::testing::Return;

TEST(TestUtility, ArithmeticCalculation)
{
    Utility util;
    EXPECT_EQ(util.ArithmeticCalculation(ADD, 1, 1), 2);
    EXPECT_EQ(util.ArithmeticCalculation(MINUS, 2, 1), 1);
    EXPECT_EQ(util.ArithmeticCalculation(MULTIPLE, 3, 3), 9);
    EXPECT_EQ(util.ArithmeticCalculation(DIVIDE, 10, 2), 5);
    EXPECT_GT(util.ArithmeticCalculation(DIVIDE, 10, 0), 999999999);
}

TEST(TestMultiple, MockArithmeticCalculation)
{
    MockUtility mockOp;
    Multiple util(&mockOp);
    EXPECT_CALL(mockOp, ArithmeticCalculation(_, _, _)).Times(1).WillOnce(Return(3));
    EXPECT_EQ(util.CalcuationResultMultiple(ADD, 1, 2, 1), 3);
    EXPECT_EQ(util.CalcuationResultMultiple(ADD, 1, 2, 0), 0);
}
